var a = getApp();

Component({
    properties: {
        datas: {
            type: null
        },
        component_id: {
            type: null
        },
        page_id: {
            type: null
        },
        bottomShowBol: {
            type: null
        },
        index: {
            type: null
        },
        bottomShowBolIndex: {
            type: null
        }
    },
    data: {
        emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png",
        clientWidth: "375",
        U_tabcontrol: !0,
        isLast: !1,
        active: 0,
        show_text: "没有数据",
        show_page: !0,
        currentTime: parseInt(new Date().getTime() / 1e3),
        joinListData: [],
        tabIndexActivityId: 0,
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        group_number: 100,
        activeIds: []
    },
    lifetimes: {
        attached: function() {},
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {
        var a = this;
        this.setData({
            clientWidth: wx.getSystemInfoSync().windowWidth
        }), this.data.bottomShowBolIndex == this.data.index && this.setData({
            isLast: !0
        }), this.data.datas.list.length > 0 && (this.data.group_number = this.data.datas.group_number ? this.data.datas.group_number : 100, 
        this.data.datas.list.forEach(function(t) {
            a.data.activeIds.push(t.activity_id);
        }), this.getData());
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        init: function() {
            this.setData({
                isLoadMore: !0,
                allLoaded: !1,
                page: 1
            });
        },
        onClick: function(a) {
            this.init();
            var t = a.detail.index;
            this.setData({
                active: t
            }), this.getData();
        },
        gotoStarGroupDetails: function(a) {
            var t = a.currentTarget.dataset.id;
            wx.navigateTo({
                url: "/packageH/starMusic/starMusicGroupDetails/starMusicGroupDetails?id=" + t
            });
        },
        getData: function() {
            var t = this, e = a.getNetAddresss("plugin.decorate.admin.decorate-common.searchOpenList");
            a._postNetWork({
                url: e,
                data: {
                    activity_id: this.data.activeIds,
                    type: this.data.active,
                    show_num: 15
                },
                success: function(a) {
                    var e = a.data;
                    1 == e.result && (t.data.total_page = e.data.last_page, t.data.total_page || (t.data.total_page = 0), 
                    e.data.data.length > t.data.group_number && (e.data.data.splice(t.data.group_number, e.data.data.length - t.data.group_number), 
                    t.setData({
                        isLoadMore: !1,
                        allLoaded: !0
                    })), (e.data.data.length < 15 || e.data.last_page == t.data.page) && t.setData({
                        isLoadMore: !1,
                        allLoaded: !0
                    }), t.setData({
                        joinListData: e.data.data
                    }));
                }
            });
        },
        getMoreData: function() {
            var t = this;
            if (this.setData({
                isLoadMore: !1
            }), !(this.data.page >= this.data.total_page)) {
                this.data.page++;
                var e = a.getNetAddresss("plugin.decorate.admin.decorate-common.searchOpenList");
                a._postNetWork({
                    url: e,
                    data: {
                        page: this.data.page,
                        activity_id: this.data.activeIds,
                        type: this.data.active,
                        show_num: 15
                    },
                    success: function(a) {
                        var e = a.data;
                        if (1 == e.result) {
                            t.data.page < t.data.total_page ? t.setData({
                                isLoadMore: !0
                            }) : t.setData({
                                allLoaded: !0
                            });
                            var i = e.data.data, s = t.data.joinListData.concat(i);
                            s.length > t.data.group_number && (s.splice(t.data.group_number, s.length - t.data.group_number), 
                            t.setData({
                                isLoadMore: !1,
                                allLoaded: !0
                            })), (e.data.data.length < 15 || e.data.last_page == t.data.page) && t.setData({
                                isLoadMore: !1,
                                allLoaded: !0
                            }), t.setData({
                                joinListData: s
                            });
                        }
                    }
                });
            }
        }
    },
    observers: {
        bottomShowBol: function(a) {
            a && this.data.isLast && this.data.isLoadMore && this.getMoreData();
        }
    }
});